<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery-1.8.3.min.js"></script>
<script>
var rlist = [];

	$(function(){
			loadRights();
	});
	
	function show(obj){
			var str = $('#'+obj.parentNode.id+' ul').css('display');
			var the =$('#'+obj.parentNode.id+' ul');
			var tbico=$('#'+obj.parentNode.id).find('span')[0];
			if(str=='none'){
				tbico.style.backgroundImage='url(../img/down.png)';
			}else{
				tbico.style.backgroundImage='url(../img/right.png)';
			}
			the.slideToggle(400);	
	}
	
	<!-- 注册点击事件-->
	function reg(){
		$('.menu_title').click(function(){
				show(this);	
			});
			$('#firm_left li').click(function(){
				$('#firm_left li').css('backgroundColor','');
				this.style.backgroundColor='#CCC';
			});
	}
	
	function loadRights(){
		$.post('../getRightAward.action',{},function(data){
			rlist=data;
			getAllParent();
		},'json');
	}
	
	function  getAllParent(){
		var plist = {};
		for(var i=0;i<rlist.length;i++){
			plist[rlist[i].prid]=rlist[i].parentR;
		}
		$('#firm_left').html('');
		for(var key in plist){
			$('#firm_left').append('<div class="menu" id="'+key+'"><span class="menu_title">'+plist[key]+'</span><ul></ul></div>');
		}
		
		for(var i=0;i<rlist.length;i++){
			if(rlist[i].noMenu){
				continue;
			}
			var pid = rlist[i].prid;
			$('#'+pid+' ul').append('<a href="../'+rlist[i].rurl+'" target="mainFrame"><li>'+rlist[i].name+'</li></a>');
		}
		reg();
	}
	
</script>
</head>

<body>

<div id="firm_left">

  <div class="menu" id="m7">
        <span class="menu_title">父菜单</span>
        <ul>
        	<a href="../DDL/" target="mainFrame"><li>名称</li></a>
        </ul>
  </div>
  
  
  
</div>
</body>
</html>
